package pacman.entries.pacman.meta_graph.features;

import pacman.entries.pacman.meta_graph.IMetaGraphFeature;
import pacman.entries.pacman.meta_graph.IMetaGraphObject;
import pacman.entries.pacman.meta_graph.MetaGraph;
import pacman.entries.pacman.meta_graph.MetaGraphEdge;
import pacman.game.Constants.GHOST;
import pacman.game.Game;

public class EdgeFeatureNonedibleGhostOnEdge implements IMetaGraphFeature {

	private final float PENALTY = 15.0f;
	
	@Override
	public float Evaluate(IMetaGraphObject object, Game game) {
		
		MetaGraphEdge edge = (MetaGraphEdge)object;
		
		float score = 0.0f;
		
		for (GHOST ghost : GHOST.values()) {
			// don't be afraid of edible ghosts
			if (game.getGhostEdibleTime(ghost) > 0.0f)
				continue;
			
			MetaGraphEdge ghostEdge = MetaGraph.currentGraph().getEdgeFromGraphNode(game.getGhostCurrentNodeIndex(ghost));
			if (ghostEdge != null && ghostEdge.equals(edge))
				score -= PENALTY;
		}
		
		return score;
	}

}
